﻿#include"myset.h"
#include"mymap.h"
#include"myrbtree.h"

void test_map()
{
	Map<string, string> dict;
	dict.insert({ "sort", "排序" });
	dict.insert({ "left", "左边" });
	dict.insert({ "right", "右边" });
	Map<string, string>::iterator it = dict.begin();
	while (it != dict.end())
	{
		// 不能修改first，可以修改second
		//it->first += 'x';
		it->second += 'x';
		cout << it->first << ":" << it->second << endl;
		++it;
	}
	cout << endl;
}
void Print(const Set<int>& s)
{
	Set<int>::const_iterator it = s.cbegin();
	while (it != s.cend())
	{
		cout << *it << " ";

		++it;
		// 不⽀持修改
		//*it += 2;
	}
	cout << endl;
}

void test_set()
{
	Set<int> s;
	int a[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
	for (auto e : a)
	{
		s.insert(e);
	}
	for (auto e : s)
	{
		cout << e << " ";
	}
	cout << endl;
	Print(s);
}

int main()
{
	test_set();
	return 0;
}